|
|
|
|
|
|
|
Notice that at the end of this routine I have commented out an alternate way to store databy passing all the relevant information directly to the KeySave() method. |
|
|
|
|
|
|
|
|
Using the Registry Class to Save Many Values |
|
|
|
|
|
|
|
|
If you click the Save Many Values command button, youll save many hard-coded values to the Registry under the section specified in the Section text box. Heres the code: |
|
|
|
 |
|
|
|
|
Private Sub cmdSetMany_Click()
Dim oReg As Registry
Set oReg = New Registry
With oReg
.ConfigName = txtConfig
.Section = txtSection
.KeySave strKeyValue:="Employee.mdb", _
strKeyName:="File"
.KeySave strKeyValue:="-1", _
strKeyName:="JetMDB"
.KeySave strKeyValue:="0", _
strKeyName:="OnServer"
.KeySave strKeyValue:="1.1.1", _
strKeyName:="Version"
End With
Set oReg = Nothing
End Sub |
|
|
|
|
|
|
|
|
In this routine, you see a lot of calls to the KeySave() method. Also, notice the use of named arguments. |
|
|
|
|
|
|
|
|
The KeySave() Method of the Registry Class |
|
|
|
|
|
|
|
|
The KeySave() method is very similar to the KeyGet() method in that it receives optional arguments and assigns them to the appropriate module-level variables. Then, the SaveSetting statement is called to write the information. Heres the code: |
|
|
|
 |
|
|
|
|
Public Sub KeySave( _
Optional strKeyValue As String = "NA", _ |
|
|
|
|
|